function checkRequired( form ){
    var error = false;
    $(form).find(".required").each(function(){
        if(this.value=="" || this.value==0  ){
            $(this).parents(".control-group").removeClass("success").addClass("error");
            error = true;
        }else{
            $(this).parents(".control-group").removeClass("error").addClass("success");
        }
    });
    return (error==false);
}
/* main js */
$(function(){
    //uniform - styler for checkbox, radio and file input
	$("input:checkbox, input:radio, input:file").not('[data-no-uniform="true"],#uniform-is-ajax').uniform();
    
    //chosen - improves select
	$('[data-rel="chosen"],[rel="chosen"]').chosen();
    
    
    var current_url = window.location.href.replace(window.location.protocol +"//"+ window.location.hostname,"");
    $(".jactive").find("a[href='"+current_url+"']").parents("li").addClass("active");
});

$.fn.loadDataTable = function(link, send_data, method, type ){
    var that = $(this);
    return this.each(function(){
        var _send_sdata = null;
        if(send_data != undefined){
            _send_sdata = send_data; 
        }
        
        var _method = 'post';
        if(method != undefined){
            _method = method;
        }
        
        var _type ='html';
        if(type!=undefined){
            _type = type;
        }     
        
        if($(".ajax-loaders").css("display")=='none'){
            $(".ajax-loaders").show();
        } 
          
        $.ajax({
            url: link,
            data: _send_sdata,
            type: _method,
            dataType: _type,
            success: function(result){
                if(_type=='html') that.html(result);
                $(".ajax-loaders").hide();
            }
        });
    });
    
}